A Normalization Code in Standard Ml Datatype 'a Option = None | Some of 'a 7 Conclusion and Future Work

نویسنده

  • Robert Harper
چکیده

The following Standard ML code can be used for solving constraint systems. The code assumes that phase 1 described earlier has been performed during constraint generation. The imperative aspects of Standard ML have been used a lot and we believe that this must be done for the complexity analysis to hold. For readability we have used standard list notation for the dependency lists although our complexity analysis requires that the append operation on lists is O(1) in time complexity. The code for a couple of simple subroutines has been omitted for space reasons. The code has been replaced by an ellipsis and a comment describing what the code should do. The functions find and findL are standard, see Tar83, Section 2.1]. val Snode = ref STATIC val DLnode = ref (BTLEQR (ref None)) val Dnode = ref (DYNAMIC DLnode) val worklist = ref (nil : Constraint list) val btvarlist = ref (nil : BType ref list) (* Follow BTLINKs using transition compression: *) fun find n = ... (* Follow BTLLINKs using transition compression: *) fun findL nl = ... fun isD n = (find n = Dnode) fun isDL nl = (findL nl = DLnode) fun isvar (BTVAR _) = true | isvar _ = false fun geteqr (ref (DYNAMIC eqr)) = eqr | geteqr (ref (BTVAR (dps,eqr))) = findL eqr | geteqr _ = crash () fun getmem (ref (BTLEQR mem)) = mem | getmem _ = crash () fun apply f xs = (map f xs; ()) fun mk_eqconstraint c = worklist := EQUAL c :: (!worklist) fun update_dps (k,n) = (k := !k-1; if !k = 0 then mk_eqconstraint (n,Dnode) else ()) fun doC1 (l1,r1) (l2,r2) = (* Combination rule 1 *) case (!(find l1),!(find l2)) of (CONSTR c1,CONSTR c2) => apply mk_eqconstraint (zip (r1::c1) (r2::c2)) | _ => crash () fun doC2 (l,r) = (* Combination rule 2 *) case !(find l) of (CONSTR c) => apply (fn n=>mk_eqconstraint (n,Dnode)) (r::c) | _ => crash () fun unionL n1 n2 = (* Make nodes var-equivalent *) let val (btl1,btl2) = (geteqr bt1,geteqr bt2) in if !btl1 = !btl2 then () else case (!btl1,!btl2) of (BTLEQR (ref None),BTLEQR (ref None)) => if isDL(btl1) then btl2 := BTLLINK btl1 else btl1 := BTLLINK btl2 | (BTLEQR (ref None),BTLEQR (ref (Some c))) => if isDL btl1 then doC3 c; btl2 := BTLLINK btl1 else btl1 := BTLLINK btl2 …

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Compiling Exceptions Correctly

An exception compilation scheme that dynamically creates and removes exception handler entries on the stack. A formalization of an article of the same name by Hutton and Wright [1]. 1 Compiling exception handling theory Exceptions imports Main begin 1.1 The source language datatype expr = Val int | Add expr expr | Throw | Catch expr expr consts eval :: "expr ⇒ int option" primrec "eval (Val i) ...

متن کامل

Typechecking Higher-Order Security Libraries

We propose a flexible method for verifying the security of ML programs that use cryptography and recursive data structures. Our main applications are X.509 certificate chains, secure logs for multi-party games, and XML digital signatures. These applications are beyond the reach of automated cryptographic verifiers such as ProVerif, since they require some form of induction. They can be verified...

متن کامل

An Increase in Antimicrobial Effects of Standard Antibiotics in Combination with the Active Metabolites Isolated from Marine Streptomyces: A Laboratory Study

Background and Objectives: Combination therapy has been considered as a potential approach to overcome antimicrobial resistance. In this study the antimicrobial effects of active compounds produced by some marine Streptomyces spp. in combination with some standard antibiotics against multidrug-resistant pathogens was investigated. Materials and Methods: In this laboratory study, the bacteria i...

متن کامل

The effect serum vitamin D normalization in preventing recurrences of benign paroxysmal positional vertigo .a case-control study

Background: Benign paroxysmal positional vertigo (BPPV) is a condition with recurrent attacks in a significant proportion of patients. The present case- control study was conducted to assess the influence of serum vitamin D normalization on recurrent attacks of vitamin D deficient patients. Methods: Diagnosis of BPPV was made based on history and clinical examination and exclusion of other c...

متن کامل

Transparent and Opaque Interpretations of Datatypes

Standard ML employs an opaque (or generative) interpretation of datatype speci cations, in which every datatype speci cation provides a new, abstract type that is di erent from any other type, including other identically speci ed datatypes. An alternative interpretation is the transparent one, in which a datatype speci cation exposes the underlying recursive type implementation of the datatype....

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1995